package com.demo.study.behavior.d02_command.controller.tv;

import com.demo.study.behavior.d02_command.controller.Command;
import com.demo.study.behavior.d02_command.controller.Receiver;

/**
 * 执行的命令，绑定了执行者的信息
 *
 * @author Baymax
 * @since 2022/3/25
 */
public class TvOnCommand implements Command {
    private TvReceiver receiver;

    public TvOnCommand(TvReceiver receiver) {
        this.receiver = receiver;
    }

    @Override
    public void execute() {
        receiver.on();
    }

    @Override
    public void undo() {
        receiver.off();
    }
}
